import Vue from 'vue'
import VueRouter from 'vue-router'
// 一级路由
import Login from '@/views/Login'
import Layout from '@/views/Layout'
import Setting from '@/views/Setting'
// 二级路由
import Article from '@/views/Article'
import Home from '@/views/Home'
import AddArticle from '@/views/AddAarticle'
import EditArticle from '@/views/EditArticle'
import Comment from '@/views/Comment'
import Fans from '@/views/Fans'
import Image from '@/views/Image'
import NotFound from '@/views/NotFound'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    name: 'Login',
    component: Login
}, {
    path: '/Layout',
    name: 'Layout',
    component: Layout,
    children: [
        { path: 'home', component: Home, name: 'Home' }, //素材管理
        { path: 'image', component: Image, name: 'Image' }, //素材管理
        { path: 'articles', component: Article, name: 'Article' }, //文章列表
        { path: 'addArticle', component: AddArticle, name: 'AddArticle' }, //发布文章
        { path: 'editArticle', component: EditArticle, name: 'EditArticle' }, //编辑文章
        { path: 'comment', component: Comment, name: 'Comment' }, //评论管理
        { path: 'fans', component: Fans, name: 'Fans' }, //粉丝管理
        { path: 'setting', component: Setting, name: 'Setting' }, //账户设置
    ]
}, {
    path: '*',
    name: 'NotFound',
    component: NotFound
}, ]

const router = new VueRouter({
    routes
})

export default router